package cn.com.twoke.application.game.mario.game.component;

import cn.com.twoke.application.game.mario.core.ecs.component.Component;
import lombok.Builder;
import lombok.Getter;

import java.awt.*;
import java.util.ArrayList;
import java.util.List;

public class PipeComponent implements Component {

    public enum PipeType {
        VERTICAL,
        J_SHAPED;
    }


    public PipeType type = PipeType.VERTICAL;
    /**
     * 垂直高度
     */
    public int verticalLength = 1;
    /**
     * 水平长度
     */
    public int horizontalLength = 1;
    /**
     * 是否嵌入墙壁
     */
    public boolean isEmbeddedWall = false;

    public List<PipePart> pipeParts = new ArrayList<>();

    @Builder
    @Getter
    public static class PipePart {
        private PipePartType type;
        private Rectangle shape;
    }

    public enum PipePartType {
        ENTRY_TOP, // 上边出口
        ENTRY_LEFT, // 左边出口
        VERTICAL, // 垂直部分
        HORIZONTAL, // 水平部分
        LEFT_JOINT // 左接头
        ;
    }

    public PipeComponent addPipePart(PipePartType type, Rectangle shape) {
        pipeParts.add(new PipePart(type, shape));
        return this;
    }




}
